package com.itheima.exam.web.result;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class PageResult<T> {

    private Integer code;
    private String errMsg;
    private List<T> records;

    private int totalCount;

    public static <T> PageResult OK(List records,int totalCount){
        return PageResult.builder().code(200).records(records).totalCount(totalCount).build();
    }
}
